﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Utility1;

namespace Thv.admin
{
    public partial class login : System.Web.UI.Page
    {
        protected string src_spacer;
        protected string template_path;
        protected void Page_Load(object sender, EventArgs e)
        {
            template_path = WebUtils.SystemUrl();
            src_spacer = template_path + "/admin/Images/spacer.gif";
           
           
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {

            DataClasses1DataContext dx = new DataClasses1DataContext();
            var login = from k in dx.Admin_tbs
                        where k.UserName == txtUserName.Text && k.Password == Global.ToEncoding(txtPassword.Text)
                        select k;

            foreach (Admin_tb u in login)
            {
                Session[Global.SESS_USER] = u;

            }
            Session.Timeout = 120;
            Admin_tb user_obj = (Admin_tb)Session[Global.SESS_USER];
            if (user_obj != null)
            {
                string link = template_path + "/admin/index.aspx";
                Response.Redirect("index.aspx");
            }
        }
    }
}